package com.example.minzhengtong.ui.adapter

import android.content.Context
import android.view.ViewGroup
import android.widget.LinearLayout
import com.example.minzhengtong.R
import com.example.minzhengtong.data.BannerBean
import com.example.minzhengtong.utils.WUtils
import com.youth.banner.util.BannerUtils
import com.zhy.adapter.recyclerview.CommonAdapter
import com.zhy.adapter.recyclerview.base.ViewHolder

/**
 * created by WY on 2021/6/2.
 */
class AdapterBanner(val data : MutableList<BannerBean>) : com.youth.banner.adapter.BannerAdapter<BannerBean, ImageHolder>(data){
    override fun onCreateHolder(parent: ViewGroup, viewType: Int): ImageHolder {
        val rootLayout = BannerUtils.getView(parent, R.layout.item_banner) as LinearLayout
        return ImageHolder(rootLayout)
    }

    override fun onBindView(holder: ImageHolder, data: BannerBean, position: Int, size: Int) {
        holder.imageView.setImageResource(data.logo)
    }
}